const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 8083,
    proxy: {
      // 直接访问支付服务，绕过网关
      '/api/order': {
        target: 'http://localhost:8083',
        changeOrigin: true,
        pathRewrite: {
          '^/api/order': '/api/order'
        }
      },
      '/api/payment': {
        target: 'http://localhost:8083',
        changeOrigin: true,
        pathRewrite: {
          '^/api/payment': '/api/payment'
        }
      },
      // 其他API走网关
      '/api': {
        target: 'http://localhost:10010',
        changeOrigin: true,
        pathRewrite: {
          '^/api/po': '/po'
        }
      }
    }
  }
})
